<template>
  <div class="container-big wing-blank forward-detail-page">
    <div :style="{backgroundImage: 'url(' + query.backgroundImage + ')' }" class="forward-give-card">
      <div :class="{'ticketImg':query.backgroundImage}" class="forward-give-card-info">
        <div class="forward-give-ucan-title">
          {{query.tTypeName}}
        </div>
        <!-- <p class="forward-give-card-sub-title">
          [门票转赠通知]
        </p> -->
        <div class="forward-give-card-transfer">
          <span>{{query.bName || '-'}}<em> (馈赠人)</em></span>
          <svg class="transfer-icon" viewBox="0 0 26 10" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
            <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
              <g id="转送完成" transform="translate(-221.000000, -379.000000)" fill-rule="nonzero" stroke="#FFFFFF">
                <polyline id="Path-2" points="221 387.549673 246 387.549673 237.450327 379" />
              </g>
            </g>
          </svg>
          <span>{{query.uName || ''}}<em> (受赠人)</em></span>
        </div>
        <div class="forward-give-active-code">
          <span class="code-label">
            激活码
          </span>
          <div class="code-value">
            {{query.inviteCode}}
          </div>
        </div>
      </div>
      <p class="forward-give-card-use-desc">
        <!-- 规定日期 -->
        受赠人务必在2019年9月23日点前激活，否则门票转赠将失败，您仍为门票持有人。
      </p>
    </div>
    <div class="forward-give-actions">
      <co-button class="give-action" color="primary" :disabled="!query.inviteCode" @click.stop="share">
        分享给受赠人
      </co-button>
    </div>
  </div>
</template>
<script>
import ddApi from "./../mine/ddApi";
export default {
  data() {
    return {
      query: {} //上一级参数
    };
  },
  created() {
    this.query = {
      ...this.$route.query
    };
    console.log("query", this.query);
  },
  methods: {
    async share() {
      let url = `https://${document.domain}/isv_products_pay_sell_ticket/?inviteCode=${this.query.inviteCode}&activityId=${this.query.activityId}#/mine/activation`;
      let title = this.query.activityTitle || "大会活动";
      let ticket = ` ${this.query.tTypeName} :${this.query.inviteCode}`;
      let content = `邀请您参加${title},请您尽快登录以下链接，提交激活码并进行门票激活。激活链接：${url},您的门票激活码如下：${ticket},感谢您对${title}的支持！`;
      let image = this.query.backgroundImage || "";
      let res = await ddApi.share(url, title, content, image);
    }
  }
};
</script>
<style lang="less">
.forward-detail-page {
  padding-top: 30px;
  text-align: left;
  .forward-give-card {
    width: 100%;
    height: auto;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(61, 61, 61, 0.8);
    background-repeat: no-repeat;
    background-size: 100%;
    position: relative;
    padding: 0 2px 30px;
  }

  .forward-give-ucan-title {
    display: flex;
    flex-direction: row;
    justify-content: flex-start;
    align-items: center;
    font-size: 40px;
  }
  .forward-give-card-sub-title {
    font-size: 30px;
  }

  .forward-give-card-transfer {
    margin-top: 40px;
    display: flex;
    align-items: center;
    font-size: 28px;
    color: #fff;
    .transfer-icon {
      width: 26px;
      height: 10px;
      margin-left: 16px;
      margin-right: 16px;
    }
    em {
      font-style: normal;
      font-size: 20px;
      color: #d7d8d9;
    }
  }

  .forward-give-active-code {
    margin-top: 20px;
    display: flex;
    align-items: center;
    .code-label {
      font-size: 24px;
      color: #fff;
      white-space: nowrap;
      margin-right: 16px;
    }
    .code-value {
      flex: 1;
      height: 68px;
      // background: rgba(0, 0, 0, 0.5);
      font-size: 32px;
      border-radius: 3px;
      text-align: left;
      line-height: 68px;
    }
  }
  .forward-give-card-desc {
    padding-left: 24px;
    padding-right: 24px;
  }
  .forward-give-card-desc-wrapper {
    padding: 24px 0;
    border-bottom: 1px dotted #979797;
    display: flex;
    align-items: center;
  }
  .forward-give-card-qrcode {
    width: 140px;
    height: 140px;
    background-color: fade(#d8d8d8, 30%);
    margin-right: 10px;
    flex-shrink: 0;
  }

  .forward-give-card-content-message {
    color: #fff;
    > p {
      font-size: 22px;
      white-space: nowrap;
      line-height: 38px;
      &:first-child {
        font-size: 24px;
      }
    }
  }
  .forward-give-card-use-desc {
    padding: 0 24px;
    font-size: 20px;
    color: rgba(255, 255, 255, 0.8);
  }

  .forward-give-actions {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    margin-top: 60px;
    .give-action {
      height: 90px;
      flex: 1;
      margin-left: 26px;
      white-space: nowrap;
      font-size: 30px;
      &:first-child {
        margin-left: 0;
      }
    }
  }
}

.forward-give-card-info {
  padding: 40px 32px 24px 40px;
  margin-bottom: 45px;
}
.ticketImg {
  padding-top: 116px;
}
</style>
